var RedPacketReceiveTable;
function getRedPacketReceiveList() {
	
	if (typeof RedPacketReceiveTable !== 'undefined') {
		RedPacketReceiveTable.fnPageChange('first');
		return;
	}
	var i = 1;

	RedPacketReceiveTable = $("#redPacketReceiveList")
			.DataTable(
					{
						"sAjaxSource" : _path + "/redPacketReceive/queryByPage",
						"fnServerParams" : function(aoData) {
							aoData.push({
								"name" : "liveId",
								"value" : $("#liveId").val()
							}, {
								"name" : "watchUserId",
								"value" : $("#watchUserId").val()
							}, {
								"name" : "watchUsername",
								"value" : $("#watchUsername").val()
							},{
								"name" : "fromDate",
								"value" : $("#fromDate").val()
							}, {
								"name" : "toDate",
								"value" : $("#toDate").val()
							}
							);
						},
						"sServerMethod" : "POST",
						"sAjaxDataProp" : "dataList",
						"fnCreatedRow" : function() {
							i++;
						},
						"fnPreDrawCallback" : function() {
							i = 1;
						},
						"aoColumns" : [
								{
									"sTitle" : "序号",
									"sWidth" : "2%",
									"mData" : function() {
										return i;
									}
								},
								{
									"sTitle" : "直播名称",
									"mData" : "live.name",
									"sWidth" : "10%"
								},
//								{
//									"sTitle" : "用户id",
//									"mData" : "watchUserId",
//									"sWidth" : "10%"
//								},
								{
									"sTitle" : "用户昵称",
									"mData" : "watchUsername",
									"sWidth" : "10%"
								},
								{
									"sTitle" : "领取金额",
									"mData" : "receiveMoney",
									"sWidth" : "10%"
								},
								{
									"sTitle" : "领取时间",
									"mData" : "createTime",
									"sWidth" : "10%"
								}]
//						
//								{
//									"sTitle" : "操作",
//									"sWidth" : "10%",
//									"mData" : function(data) {										
//										var status = '&nbsp;<a href="javascript:inquiry('
//											+ data.id
//											+ ');"  class="btn default btn-xs red"><i class="fa fa-trash-o" title="删除"></i></a>';
//										return status;
//									}
//								}
					});
}
function inquiry(id) {

	layer.confirm('您确定要删除吗？', {
		btn : [ '确定', '取消' ]
	// 按钮
	}, function() {
		location.href = _path + "/redPacketReceive/del/" + id;
	}, function() {

	});
}
//function rpStatus(id) {
//	var i = $("#rpStatus").val();
//	var s = $("#rpStatus").find("option:selected").text();
//	$.ajax({
//		cache : true,
//		type : "POST",
//		url : _path + "/redPacketReceive/statusSwitch?id=" + id
//				+ "&status=" + i,
//		async : false,
//		dataType : "json",
//		error : function(request) {
//			alert("连接错误！");
//		},
//		success : function(data) {
//			layer.alert("已切换为:" + s, {
//				icon : 1,
//				offset : 'middle',
//				time : 2000,
//				skin : 'layui-layer-lan' // 该皮肤由layer.seaning.com友情扩展。关于皮肤的扩展规则，去这里查阅
//			});
//			setTimeout("Refresh()", 2000);
//		}
//	})
//}
//function Refresh() {
//	location.href = _path + "/redPacketReceive/list";
//}
